/**
 * edurender
 * FullScreenQuad.fx
 * (c) 2009 J. Brad Byrd
 */

Texture2D g_texture;

SamplerState FullScreenSampler
{
	Filter = Min_Mag_Mip_Linear;
	AddressU = Clamp;
	AddressV = Clamp;
};

struct VsIn
{
	float2 position : POSITION;
	float2 texCoord : TEXCOORD;
};

struct VsToPs
{
	float4 position : SV_POSITION;
	float2 texCoord : TEXCOORD;
};

struct PsOut
{
	float4 diffuse : SV_TARGET;
};

VsToPs VsMain(VsIn input)
{
	VsToPs output;
	output.position = float4(input.position, 0.5f, 1.0f);
	output.texCoord = input.texCoord;

	return output;
}

PsOut PsMain(VsToPs input)
{
	PsOut output;
	//output.diffuse = float4(1, 1, 0, 1);
	output.diffuse = g_texture.Sample(FullScreenSampler, input.texCoord);
	
	return output;
}

DepthStencilState dss
{
	DepthEnable = False;
};

RasterizerState rs
{
	CullMode = None;
};

technique10 FullScreenQuad
{
	pass
	{
		SetVertexShader(CompileShader(vs_4_0, VsMain()));
		SetGeometryShader(NULL);
		SetPixelShader(CompileShader(ps_4_0, PsMain()));

		SetDepthStencilState(dss, 0);
		SetRasterizerState(rs);
	}
}
